package com.itheima.utils;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

;import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * @author Administrator
 */
public class RabbitMqUtil {


    public static Connection newConnection() throws Exception {
        ConnectionFactory factory = new ConnectionFactory();
        //设置ip地址
        factory.setHost("192.168.213.132");
        //设置端口
        factory.setPort(5672);
        //设置用户名
        factory.setUsername("guest");
        //设置密码
        factory.setPassword("guest");
        //设置虚拟主机名称
        factory.setVirtualHost("/");

        return factory.newConnection();
    }
}
